<?php

class Route
{
    static public $route;

    static public $module;
    static public $action;

    static private function ClearURL($string)
    {
        $string=preg_replace("/(\b(%|,)\b)|(.html|.htm)/i","", $string);
        return htmlspecialchars($string);
    }

    static public function Init($defmodule)
    {
        if(isset(Context::$get["route"]))
            Route::$route = preg_split("(/.*?|\?.*?)", Route::ClearURL(Context::$get["route"]), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);

        Route::$module = isset(Route::$route[0]) ? Route::$route[0] : $defmodule;
        Route::$action = isset(Route::$route[1]) ? strtolower(Route::$route[1]) : null;
    }

};

?>
